#include<iostream>
#include<vector>
#include<deque>
using namespace std;
deque<int> v;
int p;
void list_insert(int x)
{
    v.push_front(x);
    p=0;
}
void list_move(int d)
{
    if(d>0)
    {
        p=d+1;
    }
    else
    {
        p=p-d;
    }
}
void list_erase()
{
    v.erase(p);
}
int main()
{
    int n;
    cin >> n;
    while (n--)
    {
        int m;
        cin >> m;
        if (m == 0)
        {
            int x;
            cin >> x;
            list_insert(x);
        }
        else if (m == 1)
        {
            int d;
            cin >> d;
            list_move(d);
        }
        else
        {
            list_erase();
        }
    }
    return 0;
}